package com.treasure.mall.biz.dto.community;

import com.treasure.mall.biz.dto.BaseSearchDTO;
import com.treasure.mall.zbq.common.ienum.base.CodeDescEnumHelper;
import com.treasure.mall.zbq.common.ienum.community.CommunityEnums;
import lombok.Data;

/**
 * 
 * +---------------------------------------------------------
 * * @package: com.treasure.mall.biz.dto.condition
 * * @author: guomw (guomwchen@foxmail.com)
 * * @date: 2020/6/11 17:08
 * * @since: V1.0.0
 * +---------------------------------------------------------
 * 注意：本内容仅限于内部传阅，禁止外泄以及用于其他的商业目的
 * Copyright 2019-2022 com.treasure.mall.biz.dto.condition Inc. All rights reserved.
 */
@Data
public class CommentsSearchCondition implements BaseSearchDTO {

    /**
     * 评论类型
     */
    private int contentType = 0;

    /**
     * 文章ID
     */
    private Long articleId;

    /**
     * 评论父ID
     */
    private long parentId;

    /**
     * 获取评论类型
     *
     * @return
     */
    public CommunityEnums.CommentsContentType commentsContentType() {
        CommunityEnums.CommentsContentType commentsContentType = CodeDescEnumHelper.getEnumTypeByCode(CommunityEnums.CommentsContentType.class, this.contentType);
        if (commentsContentType != null) {
            return commentsContentType;
        }
        return CommunityEnums.CommentsContentType.COMMUNITY_ARTICLE;
    }
}
